package com.flxz.forum.service.impl;

import java.util.List;
import com.flxz.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flxz.forum.mapper.ForumCategoryMapper;
import com.flxz.forum.domain.ForumCategory;
import com.flxz.forum.service.IForumCategoryService;

/**
 * 讨论分类Service业务层处理
 * 
 * @author fl
 * @date 2025-09-14
 */
@Service
public class ForumCategoryServiceImpl implements IForumCategoryService 
{
    @Autowired
    private ForumCategoryMapper forumCategoryMapper;

    /**
     * 查询讨论分类
     * 
     * @param categoryId 讨论分类主键
     * @return 讨论分类
     */
    @Override
    public ForumCategory selectForumCategoryByCategoryId(Long categoryId)
    {
        return forumCategoryMapper.selectForumCategoryByCategoryId(categoryId);
    }

    /**
     * 查询讨论分类列表
     * 
     * @param forumCategory 讨论分类
     * @return 讨论分类
     */
    @Override
    public List<ForumCategory> selectForumCategoryList(ForumCategory forumCategory)
    {
        return forumCategoryMapper.selectForumCategoryList(forumCategory);
    }

    /**
     * 新增讨论分类
     * 
     * @param forumCategory 讨论分类
     * @return 结果
     */
    @Override
    public int insertForumCategory(ForumCategory forumCategory)
    {
        forumCategory.setCreateTime(DateUtils.getNowDate());
        return forumCategoryMapper.insertForumCategory(forumCategory);
    }

    /**
     * 修改讨论分类
     * 
     * @param forumCategory 讨论分类
     * @return 结果
     */
    @Override
    public int updateForumCategory(ForumCategory forumCategory)
    {
        forumCategory.setUpdateTime(DateUtils.getNowDate());
        return forumCategoryMapper.updateForumCategory(forumCategory);
    }

    /**
     * 批量删除讨论分类
     * 
     * @param categoryIds 需要删除的讨论分类主键
     * @return 结果
     */
    @Override
    public int deleteForumCategoryByCategoryIds(Long[] categoryIds)
    {
        return forumCategoryMapper.deleteForumCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除讨论分类信息
     * 
     * @param categoryId 讨论分类主键
     * @return 结果
     */
    @Override
    public int deleteForumCategoryByCategoryId(Long categoryId)
    {
        return forumCategoryMapper.deleteForumCategoryByCategoryId(categoryId);
    }
}
